package com.neusoft.databus.policy.dto;

import java.util.Date;

import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.dto.AbstractAuditDTO;
import com.neusoft.databus.policy.enums.EventStatus;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 事件dto
 * 
 * @author naxiang
 */
@Getter
@Setter
@ToString
public class EventDTO extends AbstractAuditDTO {
    /**
     * 
     */
    private static final long serialVersionUID = 1184552144038233382L;
    /**
     * 事件编码
     */
    @NotBlank(message = "事件编码不能为空")
    @Length(max = 255, message = "事件编码不能超过{max}位")
    private String code;

    /**
     * 事件状态
     */
    @ApiModelProperty(value = "事件状态", required = true, position = 1)
    @Enumerated(EnumType.STRING)
    @NotNull(message = "事件状态不能为空")
    private EventStatus status;

    /**
     * 事件类型
     */
    //	@ApiModelProperty(value = "事件类型", required = true, position = 3)
    //	@Enumerated(EnumType.STRING)
    //	@NotNull(message = "事件类型不能为空")
    //	private EventType type;
    /**
     * 事件级别
     */
    //	@ApiModelProperty(value = "事件级别", required = true, position = 4)
    //	@Enumerated(EnumType.STRING)
    //	@NotNull(message = "事件级别不能为空")
    //	private EventPriority priority;
    /**
     * 触发次数
     */
    @ApiModelProperty(value = "触发次数", required = false, position = 4)
    @Min(value = 1, message = "触发次数不能小于{value}")
    private Long count = 1L;

    /**
     * 事件最近发生时间
     */
    @ApiModelProperty(value = "事件最近发生时间", required = false, position = 5)
    private Date lastTime;
    /**
     * 事件解除时间
     */
    @ApiModelProperty(value = "事件解除时间", required = false, position = 6)
    private Date fixTime;

    /**
     * 事件内容
     */
    @ApiModelProperty(value = "事件内容", required = true, position = 7)
    @Length(max = 1023, message = "事件内容不能超过{max}位")
    private String content;
    /**
     * 资源编码
     */
    @ApiModelProperty(value = "资源编码", required = true, position = 8)
    @NotBlank(message = "资源编码不能为空")
    @Length(max = 255, message = "资源编码不能超过{max}位")
    private String resourceCode;

    private PolicyDTO policy;

    /**
     * 指标编码
     */
    @Length(max = 255, message = "指标编码不能超过{max}位")
    private String metricCode;
}
